home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / gas_251.zip / bin_251 / binutils / testsuite / lib / utils-lib.exp
Text File  |  1994-02-24  |  2KB  |  40 lines

  1. #   Copyright (C) 1988, 1990, 1991, 1992 Free Software Foundation, Inc.
  2.  
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; either version 2 of the License, or
  6. # (at your option) any later version.
  7. # This program is distributed in the hope that it will be useful,
  8. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  10. # GNU General Public License for more details.
  11. # You should have received a copy of the GNU General Public License
  12. # along with this program; if not, write to the Free Software
  13. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  14.  
  15. # Please email any bugs, comments, and/or additions to this file to:
  16. # bug-dejagnu@prep.ai.mit.edu
  17.  
  18. # This file was written by Rob Savoye. (rob@cygnus.com)
  19.  
  20. proc binutil_version { prog } {
  21.     if {[which $prog] == 0} then {
  22.     perror "$prog can't be run, file not found."
  23.     return ""
  24.     }
  25.     catch "exec $prog --version < /dev/null" tmp
  26.     # Should find a way to discard constant parts, keep whatever's
  27.     # left, so the version string could be almost anything at all...
  28.     regexp "version (cygnus-|)\[-0-9.a-zA-Z-\]+" $tmp version
  29.     if ![info exists version] then {
  30.         return "[which $prog] (no version number)\n"
  31.     }
  32.     set tmp $version
  33.     if [info exists errorInfo] then {
  34.     unset errorInfo
  35.     }
  36.     return "[which $prog] $version\n"
  37. }
  38.